<?php

namespace App\Events\Admin\V1;

use Illuminate\Broadcasting\Channel;
use Illuminate\Broadcasting\InteractsWithSockets;
use Illuminate\Broadcasting\PresenceChannel;
use Illuminate\Broadcasting\PrivateChannel;
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
use Illuminate\Foundation\Events\Dispatchable;
use Illuminate\Queue\SerializesModels;

class LoginEvent
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    /**
     * @var
     */
    protected $login_user;

    /**
     * @var
     */
    protected $login_token;

    /**
     * LoginEvent constructor.
     * @param $login_user
     * @param $login_token
     */
    public function __construct($login_user, $login_token)
    {
        $this->login_user = $login_user;
        $this->login_token = $login_token;
    }

    /**
     * @return mixed
     * @author 陈文小超
     * @maxim from专注to执行
     * @time 2021/3/24/14:21
     */
    public function getUser()
    {
        return $this->login_user;
    }

    /**
     * @return mixed
     * @author 陈文小超
     * @maxim from专注to执行
     * @time 2021/3/24/14:21
     */
    public function getToken()
    {
        return $this->login_token;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return new PrivateChannel('channel-name');
    }
}
